# -*- coding:utf-8 -*-
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from . import flowModuleTree
class FlowModulePanel(QFrame):
    picPath = "./com/mat/rpa/views/workWindow/rightPanel/images/"
    def __init__(self, parent=None):
        super(FlowModulePanel, self).__init__(parent)
        self.parentPanel = parent
        #设置布局管理器
        self.entireLayout = QVBoxLayout()
        self.setLayout(self.entireLayout)
        self.entireLayout.setContentsMargins(0,0,0,0)
        self.entireLayout.setSpacing(0)
        #安装topPanel
        self.topPanel = QWidget()
        self.entireLayout.addWidget(self.topPanel, 0.5)
        self.topPanelLayout = QHBoxLayout()
        self.topPanel.setLayout(self.topPanelLayout)
        self.topPanelLayout.setContentsMargins(0,0,0,0)
        self.topPanelLayout.setSpacing(0)
        ##安装提示label
        self.hintLabel = QLabel()
        self.hintLabel.setText("流程")
        self.topPanelLayout.addWidget(self.hintLabel)
        self.topPanelLayout.addStretch(1)
        ##安装StackedWidget
        self.stackedWidget = QStackedWidget()
        self.stackedWidget.setMaximumHeight(100)
        self.stackedWidget.setContentsMargins(0,0,0,0)
        self.topPanelLayout.addWidget(self.stackedWidget)
        ###安装按钮panel,并且都右对齐
        self.btnPanel = QWidget()
        self.btnPanelLayout = QHBoxLayout()
        self.btnPanel.setLayout(self.btnPanelLayout)
        self.btnPanelLayout.setContentsMargins(0,0,0,0)
        self.btnPanelLayout.setSpacing(0)
        # self.btnPanelLayout.addStretch(1)
        self.addNewFlowBtn = QPushButton()
        self.addNewFlowBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath+"newFlow.png")))
        self.btnPanelLayout.addWidget(self.addNewFlowBtn)
        self.addPythonModuleBtn = QPushButton()
        self.addPythonModuleBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath+"newPython.png")))
        self.btnPanelLayout.addWidget(self.addPythonModuleBtn)
        self.searchBtn = QPushButton()
        self.searchBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath + "search.png")))
        self.btnPanelLayout.addWidget(self.searchBtn)
        self.ellipsisBtn = QPushButton()
        self.ellipsisBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath + "verticalEllipsis.png")))
        self.btnPanelLayout.addWidget(self.ellipsisBtn)
        self.folddingBtn = QPushButton()
        self.folddingBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath + "doubleRightArrow.png")))
        # self.btnPanelLayout.addWidget(self.folddingBtn)
        self.stackedWidget.addWidget(self.btnPanel)
        self.stackedWidget.setCurrentIndex(0)
        #另一个搜索框面板
        self.searchBoxPanel = QWidget()
        self.searchBoxPanelLayout = QHBoxLayout()
        self.searchBoxPanel.setLayout(self.searchBoxPanelLayout)
        self.searchBoxPanelLayout.setContentsMargins(0,0,0,0)
        self.searchBoxPanelLayout.setSpacing(0)
        self.searchBox = QLineEdit()
        self.searchCloseBtn = QPushButton()
        self.searchCloseBtn.setIcon(QIcon(QPixmap(FlowModulePanel.picPath + "closeSearch.png")))
        self.searchBoxPanelLayout.addWidget(self.searchBox)
        self.searchBoxPanelLayout.addWidget(self.searchCloseBtn)
        self.stackedWidget.addWidget(self.searchBoxPanel)
        #添加流程树
        self.flowTree = flowModuleTree.FlowModuleTree(self)
        self.entireLayout.addWidget(self.flowTree,9.5)








